package com.hhkj.admin.sale.common.cont;

import com.ruoyi.common.exception.GlobalException;
import lombok.AllArgsConstructor;
import lombok.Getter;

public class SaleConst {

    public static final String SALE_MANAGEMENT_EXPORT_TITLE = "商家管理数据汇总";

    public static final Integer PASSWORD_NUM = 6;

    @AllArgsConstructor
    @Getter
    public enum TypeEnum {

        ROOT("销售", "root"),

        SALE("商家", "sale");

        private final String name;

        private final String code;
    }

    @AllArgsConstructor
    @Getter
    public enum DisabledFlag {

        YES("禁用", 1),

        NO("启用", 0);

        private final String name;

        private final Integer code;

        public static String getNameByCode(Integer code) {
            for (DisabledFlag value : DisabledFlag.values()) {
                if (value.code.equals(code)) {
                    return value.name;
                }
            }
            throw new GlobalException("找不到对应的code，请联系管理员");
        }
    }
}
